package com.example.auth.service.impl;

import com.example.auth.dao.ClientServiceRepository;
import com.example.auth.dao.mongdb.MongoClientServiceRepository;
import com.example.auth.model.SysClientService;
import com.example.auth.service.ClientServiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by wangtao on 2018/3/6.
 */
@Service
public class ClientServiceServiceImpl implements ClientServiceService {

    @Autowired
    private ClientServiceRepository clientServiceRepository;

    @Autowired
    private MongoClientServiceRepository mongoClientServiceRepository;

    @Override
    public void synClientServiceCache() {
        List<SysClientService> list = clientServiceRepository.findAll();
        if(!list.isEmpty()){
            mongoClientServiceRepository.save(list);
        }
    }
}
